﻿using Repository.MODELs;
using System;
using Windows.UI.Xaml.Data;

namespace Antares.Converters
{
    public class TimeToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var model = value as TaskModel;
            if (model == null) throw new NullReferenceException("model is null");
         
            var edt = DateTime.Parse(model.EndDate);

            return model.Status == 0
                       ? (DateTime.Now < edt ? "../Assets/TaskTemplate/ondue.png" : "../Assets/TaskTemplate/overdue.png")
                       : "../Assets/TaskTemplate/done.png";
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
